package net.io;

import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.SocketChannel;
import java.nio.channels.WritableByteChannel;

public class ChargenClient
{
	public static int DEFAULT_PORT = 19;
	public static void main(String[] args)
	{
		try
		{
			SocketAddress address = new InetSocketAddress(DEFAULT_PORT);
			SocketChannel client = SocketChannel.open(address);
			ByteBuffer buffer = ByteBuffer.allocate(70);
			WritableByteChannel out = Channels.newChannel(System.out);
			while((client.read(buffer)!=1))
			{
				buffer.flip();
				out.write(buffer);
				buffer.clear();
			}
		}
		catch (Exception e)
		{
		}
	}
}
